$(function(){
	var ary = new Array();
	var $modal = $('#my-modal-loading');
	var page = 1;
	var query_id = localStorage.getItem("query_id");
	console.log("store_id:" + query_id);
	var urlPath = "http://yx.fxtourong.com/V1/Circle/circleBlacklist" + "?store_id=" + query_id;
	var btn = $("#bottom_more");
	$modal.modal();
	getData();
	
	btn.click(function(){
		$modal.modal();
		page = page + 1;
		getData();
	});
		
	function getData(){
		$.ajax({
			type: "POST",
			url: urlPath,
			data: {
				token : localStorage.getItem("token"),
				page : page
			},
			dataType: "json",
			success: function(data) {
				$modal.modal('close');
				var code = data.code;
				console.log(code);
				if(code == "1") {
					btn.css("display", "block");
					var jsonStr = data.data;
					for(var i = 0; i<jsonStr.length; i++){
							var industry = jsonStr[i];
							ary.push(industry);
							console.log(industry.identity);
							$("#member_ul").append("<li style='height:1px;'><div style='height:1px;border-bottom:1px solid #f5f6f7'></div></li><li value='" + (((page-1) * 10) + i) + "' class='am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left'>" + 
						        "<div class='am-u-sm-2 am-list-thumb'>" +
						         "<img class='am-circle' src='" + industry.avatar + "' style='width: 48px;height: 48px;margin-left: 10px;'/>" + 
						        "</div>" + 
						        "<div class=' am-u-sm-10 am-list-main' style='margin-top: 10px;'>" + 
						            "<h3 class='am-list-item-text'><span style='font-size: 16px;margin-left: 8px;'>" + industry.nickname + "</span></h3>" + 
						        "</div>" + 
					      	"</li>");
						}	
				} else {
					btn.css("display", "none");
					if(page == 1){
						$("#empty_img").css("display", "block");
					}
				}
			},
			error: function(e){
				$modal.modal('close');
			}
		});
	}
	
	$(document).on("click touchstart","li",function(){
		var m = $(this).val();
		var headImage = localStorage.getItem("head_image"); //我的头像
		console.log("image1:" + headImage);
		var imagehead = ary[m].avatar;
		console.log("image2:" + imagehead);
		if(headImage == imagehead){
			alert("不能给自己发私信")
		} else {
			$(this).addClass('shit');
			localStorage.setItem("person_id", ary[m].identity);
			console.log(ary[$(this).val()].identity);
			location.href = "person_main.html";
		}
		
	}); 
	
	
});
